{extend name="public:base" /}

{block name="css"}
<link href="/static/laydate/theme/default/laydate.css">
{/block}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <!--<div class="ibox-title">
                    <a href="{:url('doUser')}" class="btn btn-primary btn-lg">注册</a>

                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="iconfont icon-chevron-up"></i>
                        </a>
                    </div>
                </div>-->

                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>名称</th>
                                <th>封面</th>
                                <th>虚拟人名称</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>{$vo.name}</td>
                                <td><img src="{:getPicture($vo.cover_id)}" style="height: 150px; width: auto" alt=""></td>
                                <td>{$vo.virtualman_name}</td>
                                <td>{:timeFormat($vo.create_time)}</td>
                                <td class="project-actions">
                                    <a href="{:url('doLive', ['id' => $vo.id])}" class="btn btn-white btn-sm">
                                        <i class="iconfont icon-edit"></i> 详情
                                    </a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>


<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated flipInY">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">续费</h4>
            </div>
            <div class="modal-body">
                <select class="form-control form-control-lg" disabled>
                    <option value="1">续费时长：1年（365天）</option>
                </select>

                <input type="text" class="form-control renew_time" placeholder="请输入续费时长（分钟）" style="margin-top: 10px">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white close-model" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="confirmRenew">确认续费</button>
            </div>
        </div>
    </div>
</div>

{/block}

{block name="js"}
<script src="/static/laydate/laydate.js"></script>

<script>
    laydate.render({
        elem: '.screen-date' //指定元素
    });

    var user_id = 0;

    function chooseUser(id) {
        user_id = id;
    }

    $('#confirmRenew').click(function () {
        var renew_time = $('.renew_time').val();
        $.post('/admin/manage/renew', {user_id, renew_time}, res => {
            if (res.result == 1) {
                layer.msg(res.msg);
                setTimeout(function () {
                    window.location.reload();
                }, 500)
            } else {
                layer.msg(res.msg);
            }
        }, 'JSON')
    })
</script>{/block}